<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>输入购买次数</title>
<!-- Bootstrap -->
<link href="./css/bootstrap.min.css"
	rel="stylesheet">
<link href="./css/profile_style.css" rel="stylesheet">
<link href="./css/response.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="./js/lib/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="./js/lib/bootstrap.min.js"></script>
<script src="./js/lib/style.js"></script>
<script type="text/javascript">
	$(function (){
		//确认购买
		$("#buyBtn").on("click",function (){
			var lineTimes = $("#lineTimes").val();
			if ($.trim(lineTimes) != '') {
				$.ajax({
					url : "http://www.udppvr.cn:80/profile/countTotalMoney.do",
					method : 'post',
					data : {
						buyType : 'line',
						totalTimes : lineTimes
					},
					success : function (rs){
						$("#modelText").text("本次购买共需花费" +rs.message + "元");
						$('#myModal').modal();
					},
					dataType : 'json'
				});
			}
		});
	});
	//确认支付
	function buyProduct(){
		var lineTimes = $("#lineTimes").val();
		if ($.trim(lineTimes) != '') {
			$.ajax({
				url : "http://www.udppvr.cn:80/profile/buyProduct.do",
				method : 'post',
				data : {
					buyType : 'line',
					totalTimes : lineTimes
				},
				success : function (rs){
					$('#myModal').modal('hide');
					if(rs.iserror){						
						$("#msg").html('<span style="color:red">' + rs.message + '</span>');	
					}else{
						$("#msg").html('<span>' + rs.message + '</span>');
					}
			
				},
				dataType : 'json'
			});
		}
	}
</script>
</head>
<body>
	<h1 class="logo">购买次数</h1>
	<br />
	<form id="fm" method="post">
		<div class="form-group">
         <input type="number" class="form-control input-lg" id="lineTimes" name="lineupTimes" placeholder="请输入购买次数"/>
		</div>
		<div class="form-group">
			<div id="msg" style="text-align:center;font-size: 1.2em;"></div>
		</div>
		<button id="buyBtn" type="button" class="btn btn-primary btn-lg btn-block">确认购买</button>
	</form>

	<br />
	<div class="heights">&nbsp;</div>
	<nav>
     
<dl>
  <dt>
    <a href="./index.html"><img
      src="./images/nav1.png" width="65" height="35" /></a>
  </dt>
  <dd>
    <a href="./index.html">首页</a>
  </dd>
</dl>
<dl>
  
  <dt>
    <a href="./search.html"><img
      src="./images/nav2.png" width="65" height="35" /></a>
  </dt>
  <dd>
    <a href="./search.html">精确查找</a>
  </dd>
  
  
</dl>
<dl>
  <dt>
    <a href="./novice.html"><img
      src="./images/nav3.png" width="65" height="35" /></a>
  </dt>
  <dd>
    <a href="./novice.html">新手教程</a>
  </dd>
</dl>

<dl>
  <dt>
    <a href="./toUserCenter.html"><img
      src="./images/nav4.png" width="65" height="35" /></a>
  </dt>
  <dd>
    <a href="./toUserCenter.html">会员中心</a>
  </dd>
</dl>


<div class="clearfix"></div>
    </nav>
		<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" 
               data-dismiss="modal" aria-hidden="true">
                  &times;
            </button>
            <h4 class="modal-title" id="myModalLabel">
               	购买提醒
            </h4>
         </div>
         <div class="modal-body" id="modelText">
         </div>
         <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal">取消
            </button>
             <button type="button" class="btn btn-primary" onclick="buyProduct();">
               	确定支付
            </button>
         </div>
      </div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
</body>
</html>